home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / external / sharelib / Makefile < prev    next >
Encoding:
Makefile  |  1997-07-08  |  4.0 KB  |  159 lines

  1. #   $Id: Makefile,v 1.2 1997/04/02 22:07:42 beth Exp $
  2. #
  3. #  Copyright (c) 1988-1997, Research Systems Inc.  All rights reserved.
  4. #  This software includes information which is proprietary to and a
  5. #  trade secret of Research Systems, Inc.  It is not to be disclosed
  6. #  to anyone outside of this organization. Reproduction by any means
  7. #  whatsoever is  prohibited without express written permission.
  8. #
  9. #  Platform independant makefile for the IDL Call_External() examples.
  10. #
  11. SHELL=/bin/sh
  12. CFLAGS=
  13. FFLAGS=
  14.  
  15. SHL_LIBS= simple.$(SHL_EXT) double_array.$(SHL_EXT) string_array.$(SHL_EXT) \
  16.       simple_c2f.$(SHL_EXT) ftn_only.$(SHL_EXT)
  17.  
  18. # The following is the default entry point. This section will determine 
  19. # what system we are on, set the correct flags and call this same makefile
  20. # again with the correct flags.
  21.  
  22. all : 
  23.     @echo "OS type detected: "`uname`
  24.     @case `uname` in \
  25.        "SunOS") if [  -d /proc ]; then \
  26.             make libs \
  27.             "SHL_EXT=so" \
  28.             "CC=cc" \
  29.             "F77=f77" \
  30.             "C_LD=cc" \
  31.             "F_LD=f77" \
  32.             "CFLAGS=-K pic -DSPARC -G" \
  33.             "C_LD_FLAGS=-G -DSOLARIS" \
  34.             "FFLAGS=-pic -G" \
  35.             "FOBJS=ftn_only_sun.o ftn_strarr_sun.o" \
  36.             "F_LD_FLAGS=-G" \
  37.             "F_LD_POST= -lF77 -lm -lc"; \
  38.                   else \
  39.                    make libs \
  40.             "SHL_EXT=so" \
  41.             "CC=acc" \
  42.             "F77=f77" \
  43.             "C_LD=ld" \
  44.             "F_LD=ld" \
  45.             "CFLAGS=-pic -DSPARC -fsingle" \
  46.             "C_LD_FLAGS=-assert pure-text" \
  47.             "F_LD_FLAGS=-assert pure-text" \
  48.             "FFLAGS=-pic" \
  49.             "FOBJS=ftn_only_sun.o ftn_strarr_sun.o" \
  50.             "F_LD_POST= -L/usr/lang/SC3.0.1/lib -lF77 "; \
  51.                fi  \
  52.         ;; \
  53.        "AIX") make libs \
  54.             "SHL_EXT=a" \
  55.             "CC=cc" \
  56.             "F77=f77" \
  57.             "C_LD=cc" \
  58.             "F_LD=f77" \
  59.             "C_LD_FLAGS=-bM:SRE -bnoentry" \
  60.             "F_LD_FLAGS=-bM:SRE -bnoentry" \
  61.             "SIMPLE_EXPORT=-bE:simple.exp" \
  62.             "DOUBLE_EXPORT=-bE:double_array.exp" \
  63.             "STRING_EXPORT=-bE:string_array.exp" \
  64.             "SIMPLEC2F_EXPORT=-bE:simple_c2f.exp" \
  65.             "FORTRAN_EXPORT=-bE:ftn_only.exp" \
  66.             "FOBJS=ftn_only_ibm.o" \
  67.             "F_LD_POST= -lxlf -lxlf90";; \
  68.        "HP-UX") make libs \
  69.             "SHL_EXT=sl" \
  70.             "CC=cc" \
  71.             "F77=f77" \
  72.             "C_LD=ld" \
  73.             "F_LD=ld" \
  74.             "CFLAGS=+z" \
  75.             "C_LD_FLAGS=-b" \
  76.             "F_LD_FLAGS=-b" \
  77.             "FFLAGS=+z" \
  78.             "FOBJS=ftn_only_hp.o ftn_strarr_hp.o" ;; \
  79.        "IRIX" ) make libs \
  80.             "SHL_EXT=so" \
  81.             "CC=cc" \
  82.             "F77=@echo \"NOT Implemented for example: f77 \"" \
  83.             "C_LD=ld" \
  84.             "F_LD=@echo \"NOT Implemented for example: f77 \"" \
  85.             "CFLAGS=-KPIC" \
  86.             "C_LD_FLAGS=-shared";; \
  87.        "OSF1" )  make libs \
  88.             "SHL_EXT=so" \
  89.             "CC=cc" \
  90.             "F77=f77" \
  91.             "C_LD=ld" \
  92.             "F_LD=ld" \
  93.             "CFLAGS=-DOSF1" \
  94.             "C_LD_FLAGS=-S -shared" \
  95.             "F_LD_FLAGS=-S -shared" \
  96.             "FOBJS=ftn_only_osf1.o" \
  97.             "F_LD_POST= -lUfor -lfor -lFutil -lm -lots -lc";; \
  98.        "Linux" ) make libs \
  99.             "SHL_EXT=so" \
  100.             "CC=cc" \
  101.             "F77=@echo \"NOT Implemented for example: f77 \"" \
  102.             "C_LD=ld" \
  103.             "F_LD=@echo \"NOT Implemented for example: f77 \"" \
  104.             "CFLAGS=-fPIC" \
  105.             "C_LD_FLAGS=-shared";; \
  106.        *) echo "This system is not supported" ;; \
  107.        esac
  108.  
  109. libs : $(SHL_LIBS)
  110.     @echo ""
  111.     @echo "To test the call external examples, start IDL and execute one"
  112.     @echo "of the following IDL procedures: c_only, simple_c2f or ftn_only"
  113.  
  114. # C Only libs
  115.  
  116. simple.$(SHL_EXT) : simple.o
  117.     $(C_LD) $(C_LD_FLAGS) -o simple.$(SHL_EXT) simple.o $(SIMPLE_EXPORT) \
  118.         $(C_LD_POST)
  119.  
  120. double_array.$(SHL_EXT) : double_array.o
  121.     $(C_LD) $(C_LD_FLAGS) -o double_array.$(SHL_EXT) double_array.o \
  122.         $(DOUBLE_EXPORT) $(C_LD_POST)
  123.  
  124. string_array.$(SHL_EXT) : string_array.o
  125.     $(C_LD) $(C_LD_FLAGS) -o string_array.$(SHL_EXT) string_array.o \
  126.         $(STRING_EXPORT) $(C_LD_POST)
  127.  
  128. # Fortran 
  129.  
  130. simple_c2f.$(SHL_EXT) : simple_c2f.o simple_c2f1.o
  131.     $(F_LD) $(F_LD_FLAGS) -o simple_c2f.$(SHL_EXT) \
  132.         simple_c2f.o simple_c2f1.o $(SIMPLEC2F_EXPORT) $(F_LD_POST)
  133.  
  134.  
  135. ftn_only.$(SHL_EXT) : $(FOBJS)
  136.     $(F_LD) $(F_LD_FLAGS) -o ftn_only.$(SHL_EXT) $(FOBJS) \
  137.         $(FORTRAN_EXPORT) $(F_LD_POST)
  138.  
  139. # Cleanup
  140.  
  141. tidy :
  142.     rm -f *.o
  143.  
  144. clean :
  145.     rm -f *.o *.so *.sl *.a
  146.  
  147.  
  148. #  Rules for building the object files.
  149.  
  150. .SUFFIXES: .c .o .f
  151.  
  152. .c.o :
  153.     $(CC) $(CFLAGS) -c $*.c
  154.  
  155. .f.o :
  156.     $(F77) $(FFLAGS) -c $*.f
  157.  
  158.  
  159.